Hello, I tried to script a code, which copies the value of "Variant_GSP" from customer to L2, using a configuration file. I created a button for verifying if the modules with outlinks has the attribute, and a button "copy value". The script verifies if the target object has or has not the attribute "Variant_GSP", but in the output, some attributes appeared in both lists. I can't figure out the error. There's an if, but it seems that it enters both branches. This is the code:
void Verify(DBE calledfrom)
void copyAttributeValue(DBE calledfrom)
Anamaria/ System Requirement - Mon Sep 19 07:16:30 EDT 2016 |
Re: How to copy the value of some attributes from customer to L2 I guess the code gives you an error.
This
o."Variant_GSP" += tgObj."Variant_GSP""" // adds the new value to the list
if(isMember(o."Variant_GSP","TBD")){
o."Variant_GSP" -= "TBD""" } //removes TBD from the list
does not work in DXL. You cannot add or remove values from an attribute that is enumerated like that. You need to construct the whole string and assign it to the attribute i.e.
string s = "Value1\nValue2\nValue4" o."Variant_GSP" = s
Providing that Value1 is before Value2 before Value3 before Value4 etc. If you want to remove a value then you need to construct the string without it and the correct order. This is the easiest way. |
Re: How to copy the value of some attributes from customer to L2 Costas..Aravidis - Tue Sep 20 01:52:28 EDT 2016 I guess the code gives you an error.
This
o."Variant_GSP" += tgObj."Variant_GSP""" // adds the new value to the list
if(isMember(o."Variant_GSP","TBD")){
o."Variant_GSP" -= "TBD""" } //removes TBD from the list
does not work in DXL. You cannot add or remove values from an attribute that is enumerated like that. You need to construct the whole string and assign it to the attribute i.e.
string s = "Value1\nValue2\nValue4" o."Variant_GSP" = s
Providing that Value1 is before Value2 before Value3 before Value4 etc. If you want to remove a value then you need to construct the string without it and the correct order. This is the easiest way. Thank you, it helped. The code runs, but the error in the output is that it finds, for exemple:
No attribute in target object X Attribute in target object X. I mean, first it can find the attribute, then it finds the same attribute. |